package com.cold.legendary.bprocess.db.enums;

import lombok.Getter;

/**
 * 业务状态
 *
 * @author cold
 * @since 2022/3/25
 */
public enum BizStatusEnum {

    PROCESSING("processing", "进行中"),
    SUCCESS("success", "成功"),
    FAILED("failed", "失败"),
    ;
    @Getter
    private String code;
    @Getter
    private String desc;

    BizStatusEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static BizStatusEnum of(String code) {
        for (BizStatusEnum em : BizStatusEnum.values()) {
            if (em.getCode().equals(code)) {
                return em;
            }
        }
        return null;
    }
}
